package com.lanchetech.common.enums;

import lombok.Getter;

@Getter
public enum ConsumptionRecordTypeEnum {

//    record_type         tinyint                            not null comment '类型 0 购买消费增加 1 退款减少 2 管理员扣除减少 3 管理员奖励增加',
//    type                tinyint                            not null comment '收支类型 0 增加 1 减少',

    CONSUMPTION((byte) 0, (byte) 0, "购买消费增加"),
    REFUND((byte) 1, (byte) 1, "售后退款减少"),
    MANAGER_SUB((byte) 2,(byte) 1, "管理员扣除减少"),
    MANAGER_ADD((byte) 3,(byte) 0, "管理员奖励增加"),
    CLOSE_ORDER((byte) 4, (byte) 1, "关闭订单退款减少"),
    ;
    private Byte recordType;
    private Byte type;
    private String remark;

    ConsumptionRecordTypeEnum(Byte recordType, Byte type, String remark) {
        this.recordType = recordType;
        this.type = type;
        this.remark = remark;
    }

    public static Byte getTypeByRecordType(Byte recordType) {
        for (ConsumptionRecordTypeEnum item : ConsumptionRecordTypeEnum.values()) {
            if (item.getRecordType().equals(recordType)) {
                return item.getType();
            }
        }
        return (byte)0;
    }
}
